package com.think.oauth.user.security.token;

import java.util.Map;

import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter;
import org.springframework.security.oauth2.provider.token.UserAuthenticationConverter;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;

public class AdditionalJwtAccessTokenConverter extends JwtAccessTokenConverter {
	
	private DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
	
	
	public AdditionalJwtAccessTokenConverter() {
	}
	
	@Override
	public OAuth2Authentication extractAuthentication(Map<String, ?> map) {
		UserAuthenticationConverter userAuthenticationConverter = 
				new AdditionalUserAuthenticationConverter();
		accessTokenConverter.setUserTokenConverter(userAuthenticationConverter);
		return accessTokenConverter.extractAuthentication(map);
	}
}
